package com.operation;

import org.json.JSONObject;

import com.util.IPUtil;

public class ChatRongyun {
	public static String getChatToken(int userid,String name, String headpic){
		String result = "";
		if(!IPUtil.getIsrongyunzhuce().equals("false")){
			HttpSendUrl send = new HttpSendUrl();
			System.out.println(" 融云注册--userid:"+userid);
			headpic = IPUtil.getIp()+"/img/uersImg/headImg/"+headpic;
			String param = "userid="+userid+"&name="+name+"&headurl="+headpic;
			String url = IPUtil.getRongyunzhuce();
			try {
				String request = send.getSendRequest(url, param, "POST",3000);
				JSONObject js = new JSONObject(request);
				result = js.get("token").toString();
			} catch (Exception e) {
				e.printStackTrace();
			}
			System.out.println("融云注册--"+userid+" result---"+ result);
		}
		return result;
	}
}
